string to int without using any api methods